import { Module } from '@nestjs/common';
import { TypeOrmModule } from '@nestjs/typeorm';
import { AppController } from './app.controller';
import { AppService } from './app.service';
import { UsersModule } from './users/users.module';
import { TimerRecordsModule } from './timer-records/timer-records.module';
import { AuthModule } from './auth/auth.module';
import { OperationTypesModule } from './operation-types/operation-types.module';

@Module({
  imports: [
    TypeOrmModule.forRoot({
      type: 'mysql',
      host: 'localhost',
      port: 3306,
      username: 'root',
      password: '123456', // 使用您提供的密码
      database: 'factory_timer',
      autoLoadEntities: true,
      synchronize: true, // 自动同步数据库结构
      logging: true, // 显示SQL日志
    }),
    UsersModule,
    TimerRecordsModule,
    AuthModule,
    OperationTypesModule,
  ],
  controllers: [AppController],
  providers: [AppService],
})
export class AppModule {}